package adv4;

import java.util.*;

public class Lottery {

	public static void main(String[] args) {
		// TreeSet
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < 6; i++) {
			int a = (int) (Math.random() * 33 + 1);
			if (list.indexOf(a) != -1) {
				i--;

			} else {
				list.add(a);

			}
		}

		Collections.sort(list);

		list.add((int) (Math.random() * 16 + 1));
		System.out.println(list);
		Scanner in = new Scanner(System.in);
		System.out.println("请输入6个红球号码：");
		int hong = 0;
		for (int i = 1; i <= 6; i++) {
			int no = in.nextInt();
			if (list.indexOf(no) >= 0 && list.indexOf(no) <= 5)
				hong++;
		}
		int lan = 0;
		System.out.println("请输入红球号码：");
		if (list.get(list.size() - 1) == in.nextInt())
			lan = 1;
		// >>>
		if (hong == 6 && lan == 1) {
			System.out.println("一等奖。。。");
		} // ....
	}

}
